package com.zzy.test.service;

import com.zzy.test.mapper.UserMapper;
import com.zzy.test.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @author Lucas-zhang
 * @description TODO
 * @date 2022-03-20 20:06
 */
@Service
public class DefaultUserDetailsService implements UserDetailsService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {

        return userMapper.findUserByUsername(username);
    }
}
